﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using F_MODEL;
using F_BLL;
namespace MvcApplication1.Controllers
{
    public class WayBillController : zyl_LoginController
    {

        WayBillBll bll = new WayBillBll();
        Waybill way = new Waybill();
        //
        // GET: /WayBill/

        [HttpGet]
        public bool DaiHuo(string origin, string destination, decimal freeSpace, DateTime originTime, string proof, string flightInfo)
        {
            //session
            UserInfo m = new UserInfo();
            m = mod();
            way.userId = m.userId;
            way.origin = origin;
            way.destination = destination;
            way.freeSpace = freeSpace;
            way.originTime = originTime;
            way.proof = proof;
            way.flightInfo = flightInfo;
            way.waybillId = DateTime.Now.ToString("yyyyMMddHHmmssfff") + way.userId;
            way.waybillIsDel = 0;
            way.waybillStatue = 0;
            way.submitTime=DateTime.Now.ToLocalTime();
            way.waybillTimeSpan = DateTime.Now.ToLocalTime();
            way.destinationTime = way.originTime.AddHours(3);

            var xx = bll.DaiHuo(way);
            return xx;
        }

        [HttpGet]
        public List<Waybill> Getway()
        {
            //session
            UserInfo m = new UserInfo();
            m = mod();
            int id = m.userId;
            return bll.GetWay(id);
        }
    }
}
